#ifndef CXCAMERAINFO_H
#define CXCAMERAINFO_H


#include <QObject>
#include <QVector>
#include <QString>
#include <QMap>
#ifndef Q_MOC_RUN
    #include <CxType.hpp>
#endif

class CxCameraInfo : public QObject
{
    Q_OBJECT
public:

    explicit CxCameraInfo(QObject *parent = 0);
    ~CxCameraInfo();

public:

    /*      Base data type      */
    struct CameraInfo
    {
        dc1394camera_id_t                           id;
        dc1394video_modes_t                         modes;
        dc1394operation_mode_t                      operationmode;

        QString                                     vender;
        QMap<dc1394video_mode_t,dc1394framerates_t> framerates;
    };

    typedef QVector<CameraInfo>  _CameraInfos;

    enum
    {
        CX_OK,
        CX_FAILED,
        CX_INIT_1394_FAILED,
        CX_INIT_CAMERA_FAILED
    };

protected:

    /*  static  member data   */
    static  dc1394_t                    *s_dc1394;
    static  QVector<CameraInfo>         s_cameras;
    static  size_t                      s_ref;

protected:
    //Init dc1394
    _CxResult           Init();
    //Release dc1394
    _CxResult           Release();
    _CxResult           getCameraInfo(dc1394camera_id_t ,CameraInfo *);

public:

    bool                            haveMode(int ,dc1394video_mode_t    );
    bool                            haveRate(int ,dc1394video_mode_t ,dc1394framerate_t );

    void                            printInfo(int   );
    dc1394camera_t                  *newCamera(int   ,  dc1394video_mode_t    ,   dc1394framerate_t);

    const   QString                 &getcameraVender(int    );
    const   dc1394video_modes_t     &getsupportMode(int );
    const   dc1394framerates_t      &getsupportRate(int ,dc1394video_mode_t );

};

#endif // CXCAMERAINFO_H
